<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<link title=style href="style.css" type=text/css rel=StyleSheet>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<script type="text/javascript" src="/Message/js/jquery.js"></script>
		<script type="text/javascript">
		$(document).ready(function(){
			$("#regist").on("click",function(){
				var title = document.writeform.title.value;
				var writer = document.writeform.writer.value;
				var content = document.writeform.content.value;
				
				if(!title){
					alert("제목을 입력하세요");
					document.writeform.title.focus();
					return;
				}else if(!writer){
					alert("작성자를 입력하세요");
					document.writeform.writer.focus();
					return;
				}else if(!content){
					alert("내용을 입력하세요");
					document.writeform.content.focus();
				}else{
					var ok = confirm("답변하겠습니까?");
					if(ok==true){
						document.writeform.submit();
					}
				}
			});
		});
		</script>
	</head>
	<body>
		<h1>답변하기</h1>
		<hr>
		<form action="message.do?method=replyController&no=${requestScope.mto.messageNo }&messageReceiver=${requestScope.mto.messageWriter }" method="post" name="writeform">
		<table>
				<tr>
					<th>제목</th>
					<td><input type="text"name="title"size="70" value="RE:${requestScope.mto.messageTitle }"></td>
				</tr>
				<tr>
					<th>작성자</th>
					<td><input type="text"name="writer"size="30" value="${sessionScope.mto.memberId }"></td>
				</tr>
				<tr>
					<td colspan="2">
						<textarea name="content"rows="20" cols="80">${requestScope.mto.messageContent }

----------------답변------------------
</textarea>
					</td>
				</tr>
				<tr>
					<td colspan="2"align="center">
						
						<input type="button" value="답변하기" id="regist">
						
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>